﻿using System;
using System.Collections.Generic;
using System.Text;
using Entites;
using Core;
using IServices;

namespace Services
{
   public class UserApp: BaseService<User>,IUserApp
    {
   
        public UserApp(IRepository<User> db ):base( db)
        {
            this._db = db;
        
        }

        public User Login(string username ,string password)
        {
            var u = _db.GetAsync(m => m.username == username && m.paswword == password);
            if (u != null)
                return u.Result;
            return null;

        
        }

        public bool AddUser(User user)
        {
           var result=  _db.Save(user);
            return result;
        
        }

        public  IRepository<User> GetDb()
        {
            return _db;
        }

       
        
    }

    
}
